package com.example.exploreactivedemo1.fragments

import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.navigation.fragment.findNavController
import androidx.transition.TransitionInflater
import com.example.exploreactivedemo1.R
import com.example.exploreactivedemo1.base.BaseFragment
import com.example.exploreactivedemo1.databinding.FragementRegisterBinding

class RegisterFragment : BaseFragment<FragementRegisterBinding>(){

    //重写抽象函数里的inflateBinding函数
    override fun inflateBinding(
        inflater: LayoutInflater,
        container: ViewGroup?
    ): FragementRegisterBinding {
        return FragementRegisterBinding.inflate(inflater)
    }

    override fun initView(rootView: View?) {
        super.initView(rootView)

        //点击进入头像button，进入头像认证界面
         fragementBinding.goToAvatarVerifyBtn.setOnClickListener {
            findNavController().navigate(R.id.avatar_fragment)
        }

        //接受从LoginFragment传递过来的参数，其key值为userName
        val account : String? = arguments?.getString("userName")
        fragementBinding.registerLoginInput.setText(account)
    }

    override fun getLayoutResId() : Int {
        return R.layout.fragement_register
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        Log.e("RegisterFragment","onCreate part")
        //目标 Fragment 中是否设置了 sharedElementEnterTransition（你已经设置了）
        //*****步骤4： 目的地的fragement需要将imageView进行动画处理。指定进入过渡动画被定义在shared_image文件里*****
        sharedElementEnterTransition = TransitionInflater.from(requireContext()).inflateTransition(R.transition.shared_image)
    }
}